package proxy;

/**
 * @author yunfei.shang
 * @date 2018/03/26
 * @descreption 创建实现接口的代理实体类
 */
public class ImageStaticProxy implements IImage {
    private RealImage realImage;
    private String fileName;

    public ImageStaticProxy(String fileName) {
        this.fileName = fileName;
    }

    @Override
    public void display() {
        //创建代理
        if (realImage == null) {
            realImage = new RealImage(fileName);
        }
        realImage.display();
    }
}
